Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Classic UI: fix dynamic widget visibility and dynamic update of the page title #3495

Merged
merged 1 commit into from
Jun 8, 2017

Conversation

lolodomo
Copy link
Contributor

@lolodomo lolodomo commented May 20, 2017

Fix #3488
Fix #3176

Signed-off-by: Laurent Garnier lg.hc@free.fr

@lolodomo lolodomo changed the title Classic UI: fix dynamic widget visibility Classic UI: fix dynamic widget visibility and dynamic update of the page title May 20, 2017
@lolodomo
Copy link
Contributor Author

This PR also fixes the issue #2902 when using Classic UI.
Issue #2902 requires an additional fix for Basic UI.

Copy link
Contributor

@triller-telekom triller-telekom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides my comment on itemRegistry vs itemUIRegistry the code looks fine to me.

private void addItemWithName(Set<GenericItem> items, String itemName) {
if (itemName != null) {
try {
Item item = itemRegistry.getItem(itemName);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know you just re-factored this code into another method, but I am asking myself why the getItem() method is called on the itemRegistry vs itemUIregistry in case of the basicui.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're tight. I changed to itemUIregistry in Classic UI, it still works for my use cases to test the issues I am fixing with this PR. I have not done a full analysis of all possible consequences of this change from itemRegistry to itemUIregistry but I imagine it should be ok as it is with Basic UI.

…age title

Also fix update of title when linked to a group item

Fix #3488
Fix #3176

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
@lolodomo
Copy link
Contributor Author

Comment taken into account + changes squashed.

Copy link
Contributor

@triller-telekom triller-telekom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@@ -275,7 +289,9 @@ public boolean hasChangeOccurred() {
*/
@Override
public void stateUpdated(Item item, State state) {
// ignore if the state did not change
if (item instanceof GroupItem) {
changed = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks pretty dangerous to me.
Note that the Classic UI intentionally had some constraints regarding dynamic updates as every update results in a full page refresh, which lets the screen flicker, scroll and makes the UI difficult to use, if updates are too frequent.
Especially GroupItems receive MANY state updates and thus they are prone to such negative effects.

@lolodomo & @triller-telekom Did you extensively test this on large sitemaps with lots of events? We really should make sure not to cause any major new issues here. Classic UI should really be in maintenance mode and only severe stuff should be fixed on it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not check this on a very large sitemap and I was not aware of these constraints. But they surely make sense because scrolling and screen flickering isn't nice.

@lolodomo: What did you experiments say when you tested it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are in Home Automation systems, I doubt users have setup with lots of event updates per second. That is not my case.
I think I recently read that for standard groups there is no more any state update. Can you please confirm that point ? If that is true, the change will only concern groups with a function. If that is not true, I should change the code to trigger a reload on state update only for groups having a function.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Standard groups can still have a state. However, if they do not have a function their state is not derived from their member items.

If you change the code to only refresh the site for groups with a function you will miss state changes on those without function.

@lolodomo
Copy link
Contributor Author

lolodomo commented Jun 7, 2017

If you think I introduced a problem, I put in comments my fix relative to the handling of group state and then I switch to something else. At least this PR will fix the handling of visibility attribute and the update of page title for non group items.
Please let me know.

@kaikreuzer
Copy link
Contributor

I think I recently read that for standard groups there is no more any state update.

Yes, you might be right - so let's hope that this indeed does not have any "flickering" impact.

@kaikreuzer kaikreuzer merged commit b8db5e6 into eclipse-archived:master Jun 8, 2017
@lolodomo lolodomo deleted the fix_3488 branch June 8, 2017 18:18
@kaikreuzer kaikreuzer modified the milestone: 0.9.0 Jun 26, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants